define(function(require,exports,module) {
	// require('./plug/hammer.min');
	// require('./plug/layer/layer');
	// require('./shop');
    var myPub = require('./public');
    $(function() {
        var oContactBossBtn = $('.js_contactBoss');     //联系商家信息按钮 js_contactBoss
        var oBossInfo = $('.js_bossInfo');              //商家信息 js_bossInfo
        var oBossName = $('.js_bossName');              //店家名字
        var oCancelApply = $('.js_cancelApply');        //取消申请

        var oCancelAppeal = $(".js_cancelAppeal");      //取消平台申诉

        var oAgreeRefundMoney = $("#agreeRefundMoney");				//同意金额
        //同意金额
        oAgreeRefundMoney.hammer().on('tap',function() {
            var _cont = '<p class="delTipP" >确认同意商家修改的退款金额吗？</p>';
            var _this = $(this);
            myPub.askLayer(_cont,function() {
                // 跳转售后
                var woId = _this.attr("workOrderId");
                //window.location.href = '/shop/workOrder/agreeRefundAmount/'+woId;
                myPub.LayerCloseAll();
                G_JSON_POST("/shop/workOrder/agreeRefundAmount/"+woId, null, function(data) {
                    myPub.TipLayerEnd(data.message, "", function() {
                        location.reload();
                    }, "");
                });

            },function() {},"no");

        });

        // 弹出商家信息列表
        oContactBossBtn.on('click',function() {
            var styleTitle = 'width:100%;  border:none';
            var _BossName = $('.js_bossName').text();
            oBossInfo.show();
            myPub.TipTitleLayer('联系商家： '+_BossName,styleTitle, oBossInfo.html(),function() {
                oBossInfo.hide();
            });
        });


        // 售后订单被取消弹框
        oCancelApply.hammer().on('tap',function() {
            var _cont = '<p class="delTipP" >此订单正在售后处理</p><span class="delTipSpan">确认将取消售后申请</span>';
            var woId = $(this).data("woid");
            myPub.askLayer(_cont, function() {
                myPub.LayerCloseAll();
                G_JSON_POST("/shop/workOrder/cancelApply", {
                    id: woId
                }, function(data) {
                    myPub.TipLayerEnd(data.message, "", function() {
                        location.reload();
                    }, "");
                });
            }, function() {}, "no");
        });

        // 申诉取消提示框
        oCancelAppeal.hammer().on("tap", function(e) {
            var _cont = '<p class="delTipP" >此订单正在申诉处理</p><span class="delTipSpan">确认将取消申诉申请</span>';
            var woId = $(this).data("woid");
            myPub.askLayer(_cont, function() {
                myPub.LayerCloseAll();
                G_JSON_POST("/shop/workOrder/cancelAppeal", {
                    id: woId
                }, function(data) {
                    myPub.TipLayerEnd(data.message, "", function() {
                        location.reload();
                    }, "");
                });
            }, function() {}, "no");
        });


    });

});